package com.example.wang.myapplication.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;

import com.example.wang.myapplication.R;
import com.example.wang.myapplication.base.BaseToolBarActivity;


/**
 * Created by GongWen on 17/8/24.
 */

//master1 *
public class WxCommonActivity extends BaseToolBarActivity {
    AutoCompleteTextView autotext;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_common_wx;
    }

    static int index = 0;
    int pos;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (index % 2 == 0)
            startActivity(WxCommonActivity.class);
        index++;
        autotext = (AutoCompleteTextView) findViewById(R.id.autotext);
        String[] arr = {"aa", "aab", "aac", "中国"};
        ArrayAdapter arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, arr);
        autotext.setThreshold(1);
        autotext.setAdapter(arrayAdapter);
        handler.post(new Runnable() {
            @Override
            public void run() {
                pos++;
                autotext.setText(pos + "");
                handler.postDelayed(this, 1000);
            }
        });
    }

    Handler handler = new Handler();

    public void startActivity(Class<?> clazz) {
        startActivity(new Intent(WxCommonActivity.this, clazz));
    }
}
